El Mon, Jun 02, 2008 at 05:47:37PM -0300 Alexandre Oliva ha dit: > On Jun 2, 2008, Matthias Kaehlcke <matthias@xxxxxxxxxxxx> wrote: > > > namespace ns { class MyClass { friend MyClass ::operator+(MyClass, > > MyClass); private: int attribute; }; } > > This is parsed as MyClass::operator+ (whitespace is not significant), > so you end up missing the return type. ok, that's what i didn't catch > > when removing the default namespace specifier ('::') from the friend > > declaration the error message changes to: > > Then the friend declaration injects the name in the enclosing > namespace ns, so that's where you'd have to define it. A definition > in the global namespace doesn't match, so it isn't granted access to > private members. > > > i can't figure out what would be the correct friend declaration with > > the operator in the default namespace. > > Adding parentheses around the declarator id (::operator+) should work. with the parentheses it works, thanks a lot for your helpful answer! -- Matthias Kaehlcke Embedded Linux Engineer Barcelona In itself, homosexuality is as limiting as heterosexuality: the ideal should be to be capable of loving a woman or a man; either, a human being, without feeling fear, restraint, or obligation (Simone de Beauvoir) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-