Problem after compilation - Arduino Leonardo crashes

This is my code:

#include <PCF8574.h>
#include <Wire.h>

PCF8574 pcf20(0x20); // I2C Expander

class ButtonSend {

    int buttonPin;
    int buttonState;
    int lastButtonState;
    int reading;
    unsigned long lastDebounceTime;
    unsigned long debounceDelay;


    public:

    ButtonSend(int pin) {
        buttonPin = pin;
        lastButtonState = LOW;
        lastDebounceTime = 0;
        debounceDelay = 50;
        pcf20.read(buttonPin);
        pcf20.write(buttonPin, HIGH);

    }

    void Update() {
        reading = pcf20.read(buttonPin);
        if (reading != lastButtonState) {

            lastDebounceTime = millis();
        }

        if ((millis() - lastDebounceTime) > debounceDelay) {
            if (reading != buttonState) {
            buttonState = reading;

            if (buttonState == LOW) {
                Serial.println("click");
            }
            }
        }

        lastButtonState = reading;
    }

};

void setup() {
    pcf20.begin(); // I2C Expander
}
ButtonSend btn1(2);
void loop() {
    btn1.Update();

}

I'm trying to use I2C expander library - PCF8574 inside my class. I use this library Arduino/libraries/PCF8574 at master · RobTillaart/Arduino · GitHub It compiles ok, but after uploading to Arduino it is not responding - not availaible by port COM. To resotre Arduino I need to upload another project just after restart. I think this can be problem with inheritance, but my knowledge about C++ is poor.

You need a Serial.begin() call in setup()

westfw:
You need a Serial.begin() call in setup()

Thank you for the response. Unfortunently it changes nothing. Result is the same...

I doubt this has to do with your code.

As suggested above, you need the Serial.begin().You probably also want to wait till the Serial communication is ready.

void setup()
{
  pcf20.begin(); // I2C Expander

  Serial.begin(57600);
  while(!Serial);
  Serial.println("Arduino ready");
  delay(2000);
}

void loop()
{
  btn1.Update();
}

You will also need to make sure that there is space in the buffer for sending; if not, you can bring the Leonardo to a near grinding halt if the connection breaks. Below updated part of the Update method.

          if (buttonState == LOW)
          {
            if (Serial.availableForWrite() > strlen("click"))
            {
              Serial.println("click");
            }
          }

Next question is what happens in Windows device manager (or the similar stuff in Linux/Mac) after the upload.