The problem is because the arguments to your operator functions aren't const references. operator+ returns a temporary SumOp object, which cannot be passed as a non-const reference. (Some compilers may support this as an extension.)