I guess you could add an operator= for the key type of a standard map that takes in argument a type composed of key1+key2
Or if by that you mean that you want the second member of the pair of a map element to be a key, then you should probably use a set with an element type of pair<key1,key2>
perhaps map<key1, {multi}map<key2, value>> would do what you need? findmap(key1) would return all values from the begin() to end() of the multimap you find by that lookup, and findmap(key1, key2) would return only what's found by the key2 lookup?