What makes it "the best" type? Do you mean the smallest memory foot print? The most flexible datatype? The coolest name? Depending on what you mean by "best" there are different approaches to this problem.
So far for your scenario I would write the function processing the variable as the template. But how are you getting your data?
To elaborate, Computergeek01 suggests that your string-to-number function be templated so that when you decide to get, say, a float from the string it can do it.
Keep in mind that the STL already provides a stringstream that can do this. Likewise, you can use some of the <cstdlib> functions, like strtod().
I mean think about what you are asking. C++ must know what data type you are returning so it (at least) knows how much memory to allocate for it (along with other things like how to store it.) It doesn't make sense to allow a function to return a variety of data types in a language with such low-level control.
Your design is flawed, and it is not the way C++ is designed to be used. When you invoke the function, you must have a specific type in mind -- there is no way around that (at least, that doesn't involve some significant grief and non-magic, hand-written stuff).