You have to create components in the constructor of your class.
It’s the same for all types of components.
UBoxComponent* BoxComponent = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollision"));
This code will create a box component. Using the “Box Component” variable you can set all the variables like box extent, collision channel, etc in the following likes. For example:
Here’s a slightly more in depth tutorial explaining it:
https://docs.unrealengine.com/latest/INT/Programming/Tutorials/Components/1/
Cheers