If you change the friendship declaration of friendFunc in Test to:
template<typename T> friend Test<T> friendFunc(T);
so that it matches the definition, it will compile. The templatizing
of Test on R is pointless and presumably you really want the 'value'
member to be of type R?
Chris