Differentiate a particular element of the bluepint via raycast

thank you very much, this helps me to solve my problem doing it in cpp

This is what I need in cpp:

.h
UPROPERTY(BlueprintReadOnly, Category = Interacting)
class UPrimitiveComponent* interactiveLastItemComponent;

.cpp
interactiveLastItemComponent = Hit.Component.Get();