You will need two version of the operator, one for each order as you have shown above. If you have the operator as a member function the first operand is always the class object. To be able to have a different type as first operand you will have to define the operator outside the class.