Arduino Freezes when Class files in same folder

I have a test file called serialTest.ino.

This is my code for setup()

void setup()
{
  Serial.begin(9600);
  Serial.print("Test message.");
  pinMode(3, OUTPUT);
  digitalWrite(3, HIGH);
}

This code works correctly when serialTest.ino is the only file in the folder.
However, I have my class definition and implementation in Packet.h and Packet.cpp.
The Arduino Uno will not even display the light when Packet.h and Packet.cpp are in the same folder as serialTest.ino. As soon as I remove these files and restart the IDE it works as expected.

I have no idea what's going on with this and would appreciate some help.

I made a dumb mistake.
I wrote Packet a while ago to use for a Raspberry Pi and now I'm reusing it. I accidentally grabbed the test versions of Packet.

I had int main(){return 0;} inside of Packet.cpp to allow it to compile.

However, why does Arduino include these files even if I don't #include Packet.h?

It's actually kind of an interesting thing to learn. Some people who are used to writing C++ might find it strange that there is no main function in an Arduino sketch. The fact is that really there is a main() but it's hidden away in the core library, which is automatically included in your sketch. However, you can override that definition of main() if for some reason you want to do something different. I actually think the setup()/loop() system makes good sense and so I don't bother with this because I'd just end up reproducing the same program structure but I do like knowing that it is possible to disable all the Arduino IDE magic if I wanted to.

Because the IDE doesn't #include files in the same folder. It concatenates them all together. It chooses the "primary" file as the one with the same name as the folder. Then everything else is joined on the end, in alphabetical order. Then it stealthily adds function prototypes to the top.

At that point it sends the merged file to the traditional C++ compiler which executes the preprocessor and does the #includes like you would expect.

MorganS:
Because the IDE doesn't #include files in the same folder. It concatenates them all together. It chooses the "primary" file as the one with the same name as the folder. Then everything else is joined on the end, in alphabetical order. Then it stealthily adds function prototypes to the top.

That only happens with .ino files. The Arduino IDE does not do that with any files that have a different extension.