The inbuilt integer types your compiler provides are only guaranteed to be capable of storing numbers of a specific magnitude. It looks like your number is larger than that. You may find the C++ program is reporting the error - try...
if (ss >> number)
return number;
throw std::runtime_error("conversion of string to int failed");
...or whatever other error handling you feel like.
If you must use larger number, you could try double
, or if that doesn't suit your needs then check out "arbitrary precision" libraries like GMP - you'll find lots of stackoverflow questions about handling large numbers with answers suggesting, contrasting and illustrating GMP and alternatives.