I am trying to overload these two operations for a class, and I am getting really strange errors.
I've looked at a couple guides and I can't find what I am doing wrong with my declaration.
#include <iostream>
class Complex{
...
friend ostream& operator<< (ostream& out, const Complex& right);
friend istream& operator>> (istream& in, const Complex& right);
};
The errors I am getting:
error C2143: syntax error : missing ';' before '&'
error C2433: 'ostream' : 'friend' not permitted on data declarations
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2061: syntax error : identifier 'ostream'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2805: binary 'operator <<' has too few parameters
Ahhh, that fixed it! Thank you. Boy, I feel stupid now.
Weirdly, I think I had that earlier, but then I deleted the version of it when I was having problems. Oh well, it's fixed now :)