Creation of operator classes in postgresql requires the superuser attribute on the role you're using - https://www.postgresql.org/docs/9.6/sql-createopclass.html.
The user who defines an operator class becomes its owner. Presently, the creating user must be a superuser. (This restriction is made because an erroneous operator class definition could confuse or even crash the server.)
However, GCP does not allow you to add the superuser attribute to a role - https://cloud.google.com/sql/docs/postgres/users.
The postgres user is part of the cloudsqlsuperuser role, and has the following attributes (privileges): CREATEROLE, CREATEDB, and LOGIN. It does not have the SUPERUSER or REPLICATION attributes.
Is there any way to create operator classes in GCP postgresql? If so, then how?