6. Five friends all brought some cakes with them when they met. Each of them gave a cake to each of the others. They then ate all the cakes they had just been given. As a result, the total number of cakes they had between them decreased by half. How many cakes did the five friends have at the start?
A 20
B 24
C 30
D 40
E 60