#include <iostream>
class A {
public:
int a;
A(int a) : a(a) {}
};
class B {
public:
B(A *a) : a(*a) {}
int getA() {return a.a;}
private:
A &a;
};
int main() {
// your code goes here
A *a = new A{666};
B b{a};
a->a = 777;
std::cout << b.getA();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgQSB7CnB1YmxpYzoKCWludCBhOwoJQShpbnQgYSkgOiBhKGEpIHt9Cn07CgoKY2xhc3MgQiB7CnB1YmxpYzoKCUIoQSAqYSkgOiBhKCphKSB7fQoJaW50IGdldEEoKSB7cmV0dXJuIGEuYTt9CnByaXZhdGU6CglBICZhOwp9OwoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglBICphID0gbmV3IEF7NjY2fTsKCQoJQiBie2F9OwoJCglhLT5hID0gNzc3OwoJCglzdGQ6OmNvdXQgPDwgYi5nZXRBKCk7CgkKCXJldHVybiAwOwp9