#include <iostream>
#include <memory>
using namespace std;
class AFriend;
class A {
friend class AFriend;
private:
void f() { cout << "A" << endl; }
};
class AFriend {
public:
AFriend(A* a);
private:
class impl;
std::unique_ptr<impl> pimpl;
};
class AFriend::impl {
public:
impl(A* a) { a->f(); }
};
AFriend::AFriend(A* a) : pimpl(new impl(a))
{
}
int main() {
A a;
AFriend a_friand(&a);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQUZyaWVuZDsKCmNsYXNzIEEgewogIGZyaWVuZCBjbGFzcyBBRnJpZW5kOwpwcml2YXRlOgogIHZvaWQgZigpIHsgY291dCA8PCAiQSIgPDwgZW5kbDsgfQp9OwoKY2xhc3MgQUZyaWVuZCB7CnB1YmxpYzoKICBBRnJpZW5kKEEqIGEpOwpwcml2YXRlOgogIGNsYXNzIGltcGw7CiAgc3RkOjp1bmlxdWVfcHRyPGltcGw+IHBpbXBsOwp9OwoKY2xhc3MgQUZyaWVuZDo6aW1wbCB7CnB1YmxpYzoKICBpbXBsKEEqIGEpIHsgYS0+ZigpOyB9Cn07CgpBRnJpZW5kOjpBRnJpZW5kKEEqIGEpIDogcGltcGwobmV3IGltcGwoYSkpCnsKfQoKaW50IG1haW4oKSB7CiAgQSBhOwogIEFGcmllbmQgYV9mcmlhbmQoJmEpOwp9Cg==