overloading << and >> operators

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

Any help would be much appreciated.

It looks right to me...you sure you didn't forget a ; before those definitions or something.
I'm glad, I'm not completely crazy.
I'm not missing any semicolons, though, and if I comment out that bit of code the program compile no problem. :/
Did you forget the std:: in front of ostream/istream?

Oh, you also don't want a const on the operator >> Complex.
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 :)
Topic archived. No new replies allowed.