#include <iostream>

class A { 
private:
    int a;
public:
    A(int a) : a(a) { } 
    void print() { std::cout << a; }
    
    A& operator+=(const A &other) {
        a += other.a;
        return *this;
    }   
};

class B : public A { 
private:
    int b;
public:
    B(int a, int b) : A(a), b(b) { } 
    void print() { 
    	std::cout << '('; 
    	A::print();
    	std::cout << ", " << b << ')' << std::endl;
    }
    
    B& operator+=(const B &other) {
        A::operator+=(other);
        b += other.b;
        return *this;
    }   
};

int main() {
    B b1(1, 2); 
    B b2(3, 4); 
    b1.print();
    b1 += b2; 
    b1.print();
        
    return 0;
}