Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!dptg!att!cbnewsl!dog From: dog@cbnewsl.ATT.COM (edward.n.schiebel) Newsgroups: comp.lang.c++ Subject: Re: overload probelm? Message-ID: <1239@cbnewsl.ATT.COM> Date: 25 Jul 89 13:08:45 GMT References: <33951@grapevine.uucp> Distribution: na Organization: AT&T Bell Laboratories Lines: 17 From article <33951@grapevine.uucp>, by parker@grapevine.uucp (Parker Waechter): > class complex { >... > friend ostream& operator << (ostream& s, complex& comp); > }; > > ostream& complex::operator <<(ostream& s, complex& comp) {...} > "comp2.C", line 14: error: operator <<() is not a member of complex > why not? Friend functions are not members, just plain old functions which happen to enjoy access to private date of the class(es) they are friends of. Your class declaration specifies a function "ostream& operator<<" and not "ostream& complex::operator<<". Ed Schiebel AT&T Bell Laboratories