Why do i get error this declaration has no storage class or type specifier

My header file with first error

              #pragma once
              #include "CoreMinimal.h"
              #include "Engine/TriggerVolume.h"
             #include "Components/ActorComponent.h"
            #include "OpenDoor.generated.h"

            UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )

          class NEMOJDAMEZEZAS_API UOpenDoor : public UActorComponent

          {
                 GENERATED_BODY() - ERROR

ERROR - this declaration has no storage class or type specifier

And it causes another error I my .cpp file below:

           #include "OpenDoor.h"
          #include "Engine/World.h"
         #include "GameFramework/Actor.h"


         // Sets default values for this component's properties
       UOpenDoor::UOpenDoor()
        {
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;

// ...
       }


               // Called when the game starts
        void UOpenDoor::BeginPlay()
      {
Super::BeginPlay(); - ERROR 

ERROR - class UObject has no member BeginPlay

Owner = GetOwner();

ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
   }

Hey there, BeginPlay only exists for Actors, not UObjects.