#include <iostream>
class A
{
public:
A(int x) : _value(x) {}
operator int() const { return _value; }
private:
int _value;
};
class B : public A
{
public:
B(int y) : A(y) {}
};
int main()
{
A a1(1);
B b1(10);
A a2(2);
B b2(20);
std::cout << a1 << '\n';
std::cout << b1 << '\n';
std::cout << a2 << '\n';
std::cout << b2 << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgQQp7CnB1YmxpYzoKICAgIEEoaW50IHgpIDogX3ZhbHVlKHgpIHt9CgogICAgb3BlcmF0b3IgaW50KCkgY29uc3QgeyByZXR1cm4gX3ZhbHVlOyB9Cgpwcml2YXRlOgogICAgaW50IF92YWx1ZTsKfTsKCmNsYXNzIEIgOiBwdWJsaWMgQQp7CnB1YmxpYzoKCiAgICBCKGludCB5KSA6IEEoeSkge30KfTsKCmludCBtYWluKCkKewogICAgQSBhMSgxKTsKICAgIEIgYjEoMTApOwogICAgQSBhMigyKTsKICAgIEIgYjIoMjApOwoKICAgIHN0ZDo6Y291dCA8PCBhMSA8PCAnXG4nOwogICAgc3RkOjpjb3V0IDw8IGIxIDw8ICdcbic7CiAgICBzdGQ6OmNvdXQgPDwgYTIgPDwgJ1xuJzsKICAgIHN0ZDo6Y291dCA8PCBiMiA8PCAnXG4nOwp9