I think I know what the problem is.. Class element has * operator overloaded and it returns a string (when I do *element).. So what the solution would be in that case so that I can leave the overloaded operator on the element class?
Oh, yes, now it makes sense. I thought something looked wrong.

Basically, I noted that a fix is to return m_map.find(key)->second. You did not do that, but returned *(m_map.find(key)->second) instead, which is incorrect.