Textbook proof for uniqueness of inverse in a group
Irrespective of whether the group is commutative or not, $aa^{−1}=a^{−1}a=e$ and that's why the relation which you mentioned commutes.
$$aa^{−1}=e \implies a=e\cdot a $$ $$\text{ and }$$ $$ a^{−1}a=e \implies a=a\cdot e$$