Possible to access private types in base classes via template indirection
I'm trying to, at compile time, select a type to use depending on whether one is publicly available in a given scope. It's best to go straight to the code: #include <iostream> #include <type_traits> class Logger { std::string _p; public: Logger(std::string p): _p(p) { } void say(std::string message) { std::cout << _p << ' ' << message << std::endl; } }; struct Log { static Logger& log() { static Logger _def("Default: "); return _def; } }; // 1. template <typename P> struct use_logger { static std::size_t test(P*); static char test(...); static const bool value = sizeof(test(reinterpret_cast<P*