This function should be declared as const (because it returns data and doesn't modify it), otherwise you can't call it on constant instances. E.g:
As to casts:
void foo(const Var& v)
v.toString(); //discards qualifiers error, unless toString is a const method
if you want to return a reference, you don't need a cast. This is how you normally make a reference to something (i doesn't have to be a reference for a reference to refer to it):
If __data is a std::string then casting it to std::string is meaningless.
int i = 42;
int& ref = i; //note: no cast!
I seem to remember that you had other rather meaningless casts in your code, such as:
If it didn't already work without that cast (because Var has a non-explicit constructor that takes an integer argument), then the cast wouldn't do the right thing either. Normal ways to declare and initialize an instance:
Var x = 42; //if the constructor is not explicit
Var x = Var(42); //copy from a temporary