error C2027: use of undefined type 'UWidgetTree'

UWidgetTree has worked for the projects I’ve worked on in the past for fetching components in widget. However, it’s returning:

AmmoDisplay.cpp(20): error C2027: use of undefined type 'UWidgetTree'

and

AmmoDisplay.h(10): note: see declaration of 'UWidgetTree'

Why is it returning UWidgetTree is undefined type, while I’m calling it from a class inherited from UUserWidget?

My code:

AmmoDisplay.h:

 #pragma once
    
    #include "CoreMinimal.h"
    #include "Blueprint/UserWidget.h"
    #include "Components/EditableTextBox.h"
    #include "Components/PanelWidget.h"
    #include "Components/TextBlock.h"
    #include "AmmoDisplay.generated.h"
    
    class UWidgetTree;
    class UCanvasPanel;
    
    UCLASS()
    class GRENADEGAME_API UAmmoDisplay : public UUserWidget
    {
    	GENERATED_BODY()
    	
    public:
    	UAmmoDisplay(const FObjectInitializer& ObjectInitializer);
    
    	// Called every frame
    	virtual void NativeConstruct() override;
    
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AmmoText")
    		//FText DisplayText;
    		FString WidgetName;
    	
    	UPROPERTY()
    	UTextBlock* textbox;
    
    };

AmmoDisplay.cpp:

#include "../Public/AmmoDisplay.h"
#include "Public/Blueprint/UserWidget.h"
#include "Public/Slate/SObjectWidget.h"
#include "Components/CanvasPanel.h"

UAmmoDisplay::UAmmoDisplay(const FObjectInitializer& ObjectInitializer)
	:Super(ObjectInitializer)
{

}

void UAmmoDisplay::NativeConstruct()
{
	Super::NativeConstruct();

	UPanelWidget* root = Cast<UPanelWidget>(GetRootWidget());

	if (!root)
	{
		root = WidgetTree->ConstructWidget<UCanvasPanel>(UCanvasPanel::StaticClass(), TEXT("RootWidget"));
	}
}

Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "UMG", "Slate", "SlateCore" });

Any help is appreciated.

#include “UWidgetTree.h”

in .h ,and I removed the constructor.
But with the constructor, it causes errors. I wonder why.