Is there a way to override a stream operator like <<
or >>
by using other class methods, such as read() and write()?
For example,
//In the header file
class Customer
{
void read(istream &, Customer &);
istream & operator>>(Customer &) = read();
void write(ostream &, const Customer &);
ostream & operator<<(const Customer &) = write();
}
It is a requested feature from a question in the textbook, no friend
allowed.