To make this easy let covert everything using a LCD.
The LCD of 1/4 1/12 and 1/6 is 12. This becomes...
Tom ate 3/12 of the pizza.
Leftover pizza = 9/12.
Slices were 1/12.
X friends got pizza.
Remaining pizza is 2/12.
if each friend got 1 piece(1/12)....
9/12(Leftovers) - 2/12(remaining) = 7/12
So 7 friends got pizza.