I am using CRTP to implement a C++ feature.
Now I've faced a situation like this.
template<typename T>
struct A {
char a;
T operator+(const T& other){
T t;
t.a = a + other.a;
return t;
}
};
struct B : A<B>{
};
struct C : B {
C& operator=(const C& other){
a = other.a;
return *this;
}
};
int main() {
C c1,c2,c3;
c3 = c1 + c2;
return 0;
}
This code does not compile saying no viable overloaded=
How can I resolve the issue without adding any code to struct A and struct B?