Use only the appropriate trait when looking up operator overloads #12402

Fixes #12402.