Consider
namespace ns {
template<class T>
struct Ret f();
}
Here the template parameter T inhabits the template parameter scope, while both struct Ret and f inhabit the scope where the template declaration inhabits, namely the scope of ns.