Have some strange problem

Unreal editor says:
Source/MyProject/Public/DeathComp/DeathComponent.h(26) : Error: Unrecognized type ‘AMainCharacter’ - type must be a UCLASS, USTRUCT or UENUM

Code from DeathComponent:
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "DeathComponent.generated.h"

class AMainCharacter;

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_API UDeathComponent : public UActorComponent
{
    GENERATED_BODY()

public:	
     // Sets default values for this component's properties
    UDeathComponent();
 protected:
// Called when the game starts
    virtual void BeginPlay() override;
    UPROPERTY()
	    AMainCharacter* MainCharacter;
public:	
    UFUNCTION(BlueprintCallable)
	    bool GetDeath() const { return MainCharacter->IsDead; };	
};

You lack the include for the header of the maincharacter class. You forward declared it through the suffix “class”.

You inlined your function but it can’t get isdead because the class is incomplete. Either:

a) make a cpp and move the implementation for checking is dead there (including the main character header in the cpp)

b) include the main character header near the top of the class and forget the forward declararion (may cause circular dependancies though)