Quote Originally Posted by vaibhavs17
Please check my example
I tried with below code for istream and ostream.

If I tries to remove &, I was getting error.
I already told you: std::istream and std::ostream are not copyable, so trying to return objects of those types by value is wrong, as your compiler has noted.