#include <utility>

namespace util {
template< typename t >
t traits_type_entry( t const & ); // Declared, never defined.

template< typename t >
using traits_type = decltype( traits_type_entry( std::declval< t >() ) );
}

class outer_scope { // Just for illustration
    struct special;
    struct special_traits {
        typedef int value_type;
        constexpr static int limit = 5;
    };
    friend special_traits traits_type_entry( special const & );

    struct unspecial {
        typedef double baz_type;
        int table[ util::traits_type< special >::limit ];
    };

    struct special : special_traits {
        void f() {
             std::pair< typename util::traits_type< unspecial >::baz_type, value_type >();
        }
    };
};
