#include //opequal template bool operator==(Type const &lhs, Type const &rhs); //= template struct String { struct iterator { std::string::iterator d_iter; friend bool operator==<>(iterator const &lhs, iterator const &rhs); }; iterator begin() { return iterator{}; } }; //code template inline bool operator==(String::iterator const &lhs, String::iterator const &rhs) { return lhs.d_iter == rhs.d_iter; } //= int main() { String str; return str.begin() == str.begin(); }