Compilation problem

Hello
I would like to create my own sensor in ESPHome. I found this site:

I create very simple ESP Device and i pasted this code to sensors yaml file:

  libraries:
    - Wire
  includes:
    - my_custom_component.h

I Created file my_custom_component.h in folder esphome and pasted:

#include <esphome.h>
class MyCustomComponent : public Component, public Sensor {
 public:
  void setup() override {
    // This will be called once to set up the component
    // think of it as the setup() call in Arduino


  }

  void loop() {


  }

};

During compilation i have error:

INFO ESPHome 2023.12.5
INFO Reading configuration /config/esphome/studnia-lidar.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing studnia-lidar (board: esp01_1m; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- Wire @ 1.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/studnia-lidar/src/main.cpp.o
In file included from src/main.cpp:26:
src/my_custom_component.h:2:59: error: expected class-name before '{' token
    2 | class MyCustomComponent : public Component, public Sensor {
      |                                                           ^
*** [.pioenvs/studnia-lidar/src/main.cpp.o] Error 1
========================= [FAILED] Took 10.09 seconds =========================

My Home Assistant:

Home Assistant

    Core 2024.1.3
    Supervisor 2023.12.0
    Operating System 11.4
    Interfejs użytkownika 20240104.0

Could somebody help me?

The best place for help with stuff like that is the Esphome Discord forum. All the developers and people who maintain Esphome hang out in that Discord channel and theyre very helpful.