C++: Object Reference is not compatible with created node

I created c++ function by modifying “SetSkeletalMesh”.
However, object reference of mesh is not compatible with created node in Blueprint.
I can’t conect mesh reference to Target pin.
What Should I do?

This is my C++ below.

【Header File】===============================

#pragma once

#include “CoreMinimal.h”
#include “Components/SkeletalMeshComponent.h”
#include “MyLoverVRClothSimulation2.generated.h”

class MYLOVERVR_API UMyLoverVRClothSimulation2 : public USkeletalMeshComponent


UFUNCTION(BlueprintCallable, Category="ClothSimulation")
void SetSkeletalMesh2(class USkeletalMesh* NewMesh, bool bReinitPose = true);


【Cpp File】===============================

#include “MyLoverVRClothSimulation2.h”

void UMyLoverVRClothSimulation2::SetSkeletalMesh2(class USkeletalMesh* NewMesh, bool bReinitPose /= true/)
USkeletalMeshComponent::SetSkeletalMesh(NewMesh, bReinitPose);

Mesh is SkeletalMeshComponent.
You’ve declared SkeletalMesh.
You need to change your function declaration or input a skeletalmesh to the input pin.
You can retrieve the SkeletalMesh from your Mesh

Thanks for your reply!
And sorry for lack of info.
Where I want to connect is Target Pin, I show below(red circle).

This pin automatically come out when I put the node on blueprint.
Can I change Object Reference Type of Target Pin?

I couldn’t find the way to change the object reference type…

Oh… If your Mesh is surely MyLoverVRClothSimulation2 then how about cast the Mesh into your class?

Thanks for your quick reply!
You mean like this?

It was fail to cast…

Then your Mesh Shorts was not MyLoverVRClothSimulation2 Object I guess…

Yes, Mesh Shorts is Skeletal Mesh Components.
Is the way of my cast strange?

The class of an object is not just changed by casting to other class.
You need create and assign the exact instance to each object.
I think you need to change the Mesh Shorts into your class.
Where is the BP_TestHip_827 come from?
Did you change the parts into your own one? (MyLoverVRClothSimulation2 in this case)

Thanks for your pointing out about changing the mesh class!
I succeeded in connecting the target pin by creating Mesh Shorts used my original components!
Thanks to you, I have a better understanding of ue4 c++!