class MyNum(object):

    def __init__(self, x):
        self.x = x

def __add__(self, other):
    return other + self.x
__radd__ = __add__
x = MyNum(5)
y = MyNum(6)
print(x + 2)
7
print(2 + x)
7
print(x + y)
11
print(y + x)
11
Python : Operator Overloading a specific type