#include <iostream>
using namespace std;
template<class T>
class MyClass {
private:
T data;
public:
MyClass(T data) { this->data = data; }
};
template<class T>
bool operator< (const MyClass<T> & a, const MyClass<T> & b) {
return (a.data < b.data);
}
int main() {
MyClass<int> x(1);
MyClass<int> y(2);
if(x < y) cout << "x is less than y!" << endl;
return 0;
}
when i compile this it says T data is private, i know i needa declare some friend operators but not really sure how to do it :( can anyone help me please??