emplace() とその友人に関する細かい点の 1 つが欠けているに違いありません。g++ 4.9.3 で問題を再現する完全で最小限の例を次に示します。
class Foo
{
public:
class Bar
{
private:
friend class Foo;
Bar(Foo &foo) : foo(foo) {}
Foo &foo;
};
Bar &getBar()
{
//bars.push_back(*this); // works fine
bars.emplace_back(*this); // Foo::Bar::Bar(Foo&) is private
return bars.back();
}
private:
std::vector<Bar> bars;
};