Hashing /Hashtable

In the topic Hashing there is a video about creating a unordered_map of a user defined class,
in that video

  1. Why are we actually using operator overloading (==),please explain it?
    2.why we are making the operator overloading function as the constant function
    i.e
    bool operator == (const Student &d) const{
    }
    why are we using that second const,explain it in detail?
  1. == operator is overloaded to define equivalence for custom keys!, this is necessary as when initializing key-value pair, hashmap gets to know whether its a fresh entry or an update.
  2. This overloaded function is const because in C++, STL allows only const comparators for containers like set,map etc. This ensures that object parameters are never reinitialized in such functions, moreover passing a const parameter also double checks this fact!