Im trying to overload the operator<<
const ostream & operator<<(const ostream& out, const animal& rhs){
out << rhs.a;
return out;
}
it seems that im getting an error because im return a const and also because the first argument is const refrence to an ostream object.
cout << objectOfAnimal1 << objectOfAnimal2 ;
it work just fine if I change the the return type and the operator signature to this one:
ostream & operator<<(ostream& out, const animal& rhs)
constoperation!