Compiler says no appropriate operator^ is defined. But there seems to be one defined...

Code:error: no match for ‘operator^’ in ‘num ^ power::p(3u)’What am I missing?Code:#include <cassert> #include <cmath> namespace power { struct mult_p { mult_p(unsigned int n_) : n(n_) {} unsigned int n; }; struct p { p(unsigned int n_) : n(n_) {} unsigned int n; mult_p & operator *() { return mult_p(n); } }; } template<class T> T operator ^ (T & left, power::p & right) { if(!right.n) return T(1); T ret = left; for(unsigned int i = 1; i < right.n; ++i) ret *= left; return ret; } template<class T> T operator * (T & left, power::mult_p & right) { if(!right.n) return T(1); T ret = left; for(unsigned int i = 1; i < right.n; ++i) ret *= left; return ret; } int main() { using namespace power; int num = 23; int x = std::pow(static_cast<double>(num),3); int y = num**p(3); // == x int z = num^p(3); // == x assert(x == y && x == z); }

- Thanks