#include #include #include using namespace std; template class wrapper { T t; public: wrapper(const T& initial_t = T()): t(initial_t) {} template friend void outside(const U& u); template friend void inside(const T& t1) { cout << setbase(BASE) << setw(WIDTH) << wrapper(t1).t << "\n"; } }; template inline void outside(const U& u) { cout << setbase(BASE) << setw(WIDTH) << wrapper(u).t << "\n"; } template class wrapper; //explicit instantiation int main() { outside<16, 2>(10); //The 10 changes U to int. inside<10, 2>(10); outside<16, 2>(10u); //The 10u changes U to unsigned. inside<10, 2>(10u); return EXIT_SUCCESS; }