Same pointer is valid in BP but null in C++

Could it be that you trying to return UMeshComponent instead of USkeletalMeshComponent without casting it first?