Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdcad!sun!grapevine!parker From: parker@grapevine.uucp (Parker Waechter) Newsgroups: comp.lang.c++ Subject: overload probelm? Message-ID: <33951@grapevine.uucp> Date: 24 Jul 89 19:55:15 GMT Reply-To: parker@sun.UUCP (Parker Waechter) Distribution: na Organization: Sun Microsystems, Mountain View Lines: 24 The following piece of code generates an error, and I can't see why #include class complex { double r; double i; public: complex() {r = 0;i = 0;} complex(double rv, double iv = 0) {r = rv; i = iv;} friend ostream& operator << (ostream& s, complex& comp); }; ostream& complex::operator <<(ostream& s, complex& comp) {s << comp.r << " " << comp.i << "i" ; return (s); } The error it generates is: "comp2.C", line 14: error: operator <<() is not a member of complex why not? ---------------------- parker@sun.com.uucp These are my questions/opinions/problems - not Sun's