Because ifstream (and ofstream) are just specializations of istream (and ostream), (because of this whenever you call a function (or operator) that takes an ifstream as first operand the one that takes istream is seen as valid too), as indicated in this schematic table: http://www.cplusplus.com/reference/iostream/
Inverting the order you put the function declarations might (but I guarantee nothing) change the results:
first function also works correctly, but second doesn't.
I want to put "char* rightstring" in a file and bring it back and put it in a MYCLASS object.
Actually I want, without pressing any button on keyboard, put "rightstring" in MYCLASS object same as when we use cin object to put some input in an object.