An interface is the easiest solution to your problem. In laymen’s terms, an interface means “this object will implement these functions” so even if your objects are different classes, if they implement the same interface you can cast to that interface and call functions on them.
HOWEVER this means that every class you have has to implement those functions and do whatever. Usually the “whatever” part is similar in many cases which is why I usually prefer having a UInteractComponent on my objects and when I interact, I grab that component and do my stuff in there. That component will have several interact types like Loot, Dialog etc. and one Generic interact function that owners can override and do whatever they want with it.