Get type of TSubclassOf<> object

If I understood the question correctly that’s not possible. The compiler should resolve <decltype(NotifySet.Notify->GetDefaultObject())> to UBaseAnimNotify* but it will never be able to take the actual runtime value of NotifySet.Notify into account and change the return type of FindNotifyByClass from it.

From what your code looks like you don’t even have to do this since you don’t actually access any properties of the casted-to type assuming OnNotified is already declared in UBaseAnimNotify. The only place where the subclassof actually matters is the cast in FindNotifyByClass but you can also write it like this to achieve the same effect:

	static UBaseAnimNotify* FindNotifyByClass(UAnimMontage* Animation, TSubclassOf<UBaseAnimNotify> NotifyClass)
	{
		if (Animation)
		{
			for (auto NotifyEvent : Animation->Notifies)
			{
				UBaseAnimNotify* AnimationNotify = Cast<UBaseAnimNotify>(NotifyEvent.Notify);
				if (AnimationNotify && AnimationNotify->IsA(*NotifyClass))
				{
					return AnimationNotify;
				}
			}
		}
		return nullptr;
	}