USB CDC example with pic18f4550
I was in the same situation only recently and Microchip Libraries for Applications contains complete working USB examples including CDC. One thing to be aware of is that some of the USB libraries don't appear to have been updated to support XC8. I was targetting a PIC18F14K50 and received numerous compiler errors so ended up installing the older C18 compiler which is still available at MPLAB C Compiler for PIC18 MCUs.

I imagine getting it to work under XC8 would be possible but it looked like a reasonably substantial amount of work. I did notice references to XC8 in various parts of the USB stack so maybe you won't have the same problem with a PIC18F4550.