Unify class and function templates