istream >> ostream << Operator Overloading with * Pointer
How would I overload the >> and << operators if they are dealing with pointers? in header: friend std::istream& operator >>( std::istream& ins, Classname* & e); friend std::ostream& operator <<( std::ostream& outs, const Classname * e); in cpp: std::ostream& operator <<( std::ostream& outs, const Classname * e) { // what do I do here? return outs; } std::istream& operator >>( std::istream& ins, Classname* & e){ // what do I do here? return ins; } It depends on what is in the class Classname . If for example you have: class Classname { //... private: int a; }; .. then you might do: std::ostream