#include #include using namespace std; template void g(const T& t); template class wrapper { const T t; public: wrapper(const T& initial_t = T()): t(initial_t) {} friend void f(const T& t) {cout << wrapper(t).t << "\n";} friend void g(const T& t) {cout << wrapper(t).t << "\n";} template friend U h(const T& t) {cout << U(wrapper(t).t) << "\n";} }; template class wrapper; template class wrapper; int main() { cout << boolalpha << fixed; f(10); f(3.14); g(20); //The is redundant--it can be deduced from the 20. h(.1); return EXIT_SUCCESS; }