C ++: объявление друга ‘объявляет не шаблонную функцию
У меня проблема с перегрузкой<<
оператор потока, и я не нахожу решение:
template<class T, unsigned int TN>
class NVector
{
inline friend std::ostream& operator<< (
std::ostream &lhs, const NVector<T, TN> &rhs);
};
template<class T, unsigned int TN>
inline std::ostream& NVector<T, TN>::operator<<(
std::ostream &lhs, const NVector<T, TN> &rhs)
{
/* SOMETHING */
return lhs;
};
Это выдает следующее сообщение об ошибке:
warning: объявление друга ‘std :: ostream & operator << (std :: ostream &, const NVector &) 'объявляет не шаблонную функцию [-Wnon-template-friend]
error: ‘std :: ostream & NVector :: operator << (std :: ostream &, const NVector &) 'должен принимать ровно один аргумент
Как решить эту проблему?
Большое спасибо