You can get the type of an object with ::class, and compare those:
val sameClass = obj1::class == obj2::class
More specifically, this section of the above documentation describes that ::class on an object gives you exactly what you want, the exact class of the instance you’re calling it on.