The key types must be comparable using std::less (by default) . std::map is a sorted container.
You can fix it by supplying a total order for X, either via a comparison functor or by defining booloperator<(X const&, X const&), or some flavor thereof.
Edit:
This would be easier to explain if you actually posted some code.
finally i solved it. first i overloaded operator <, but that lead to different A key values being mapped to the same map key, so i added a "unique" function to distinguish between values more explicit: