The best way to implement operator+, preferring code reuse, is
class Foo
{
Foo(Foo const&);
Foo& operator+=(Foo const& rhs)
{
return *this;
}
};
and then
Foo operator+(Foo x, Foo const& y)
{
x += y; return x;
}
If you need to make a copy of the right side (this is usually not the case for specific implementation purposes), you can pass the value in both the operator+=second argument operator+.