class Bar
{
Bar(Bar const&) = default;
Bar(Bar&&) = default;
public:
Bar() = default;
friend int main();
};
void fooA(const Bar& bar)
{
//Bar bar_copy(bar); // error: 'constexpr Bar::Bar(const Bar&)' is private
}
void fooB(Bar bar) { }
int main()
{
fooB(Bar()); // OK: Main is friend
}
Y2xhc3MgQmFyCnsKCUJhcihCYXIgY29uc3QmKSA9IGRlZmF1bHQ7CglCYXIoQmFyJiYpID0gZGVmYXVsdDsKCnB1YmxpYzoKCUJhcigpID0gZGVmYXVsdDsKCQoJZnJpZW5kIGludCBtYWluKCk7Cn07Cgp2b2lkIGZvb0EoY29uc3QgQmFyJiBiYXIpCnsKCS8vQmFyIGJhcl9jb3B5KGJhcik7IC8vIGVycm9yOiAnY29uc3RleHByIEJhcjo6QmFyKGNvbnN0IEJhciYpJyBpcyBwcml2YXRlCn0KCnZvaWQgZm9vQihCYXIgYmFyKSB7IH0KCmludCBtYWluKCkKewoJZm9vQihCYXIoKSk7IC8vIE9LOiBNYWluIGlzIGZyaWVuZAp9