I tried overloading the << operator as shown directly into the public section of a class but it didn't work
ostream& operator<< (ostream& output, const Box& B){
output << B.l << " " << B.b << " " << B.h;
return output;
}
I tried overloading the << operator as shown above directly into the public section of a class but it didnt work, after asking a senior programmer about this he wrote this outside the class & made it a friend function:
friend ostream& operator<< (ostream& output, const Box& B){
output << B.l << " " << B.b << " " << B.h;
return output;
}