Suppose the first ball is chosen from A now you can calculate the probability that they are both the same colour.

Now instead; suppose the first ball is chosen from B, now you can calculate the probability that they are both the same colour.

These two cases occur with equal probability so you can combine the results in the appropriate manner to get the final answer.

CB