// friend bool operator==(const ADS_set&, const ADS_set&); template < typename K, size_t S > friend bool operator==(const ADS_set < K , S> &lhs, const ADS_set < K , S> &rhs); // friend bool operator!=(const ADS_set&, const ADS_set&); template < typename K, size_t S > friend bool operator!=(const ADS_set < K , S> &lhs, const ADS_set < K , S> &rhs); https://stackoverflow.com/ questions/3989678/c-template- friend-operator-overloading f riend is not the member of the ADS_Set class, but it is the member of namespace. since friend is non template but ADS_set is template. We are not able to declare it outside class using template. Best is to have body of friend inside class. Otherwise, change the friend function as show above, make it template and use it outside class. Comments is original function declaration, another one is changing it, so we can use it outside class template