Again, depends what you're doing.
Scout is great for playing the objective and dealing with singled out threats such as Snipers or other Scouts.
Soldier and Hybrid Demo are both extremely versatile and effective in nearly all fields.
Heavy and Medic are both best when working with a group, otherwise they're vulnerable on their own.
Pyro is sort of a "jack of all trades" due to balancing issues but thankfully they're not the best in any particular field when compared to others, only really airblasting and spy checking are best.
Spy is much like Scout when it comes down to dealing with singled out threats but can often be more useful for sneaking up on stronger enemies like Heavies.
Sniper is really just good for dealing with major threats at a distance.
Engineer is extremely well suited for defence.