Since weak_ptr doesn't support '==', but in this case you can use the comparison operator of the set try:
bool result = !(std::lexicographical_compare(set1.begin(), set1.end(),
set2.begin(), set2.end(),
set1.value_comp()) ||
std::lexicographical_compare(set2.begin(), set2.end(),
set1.begin(), set1.end(),
set1.value_comp()));
This will test for equivalence, not equality. And it lacks a certain... clarity.