One solution (which I'm using a variation on myself at the moment) is to define a common base class Base such that Derived<string> and Derived<float> both inherit from it. Then you can specify the return type as a Base*, but actually return a pointer to whichever type you actually have.

Of course, as with all things polymorphic, you have dynamic memory forced on you a bit more than you'd probably like.