#include <iostream> 

class Foo {
    struct Bar { int i; }; 
    typedef Bar return_type_from_Baz; 
public: 
    return_type_from_Baz Baz() { return Bar(); }
};

int main() {
    Foo f;
    // Foo::Bar b = f.Baz();  // error
    auto b = f.Baz();         // ok
    std::cout << b.i;
}