Python operator overloading: Implementing __add__ for +

Python operator overloading: Implementing __add__ for +

How can your Python object support +? Implement __add__:

class C:
    def __init__(self, x):
        self.x = x
    def __add__(self, other):
        return self.x + other.x
c1 = C(10)
c2 = C(15)
c1 + c2 # 25