I know how to infer the template parameter from an instantiation of a class template:
template struct foo {}; template