Has anyone done much with overloaded operators.
I've got a '<<' and a '+' which work fine but when I try to do,
cout << a + b;
it says no match for ostream& << MYCLASS
'<<' is a friend and a+b accepts parameters by value ad returns by value (not reference)
Has anyone seen anything like this before?
// this wouldn't work for cout << a + b;
friend ostream& operator<< (ostream& out, MyClass &obj);
// this works for cout << a + b;
friend ostream& operator<< (ostream& out, MyClass obj);
When you overloaded your + operator what value are you returning??
you're going to have to paste a bit of code before i can help you.. please paste your operator+ and operator<< routines.