Answer:
Both A and B are knaves.
Explanation:
Case 1: Let us assume A is a knight, thus always tells truth. Therefore, B is a knight (as that is what A says). However, B claims that the two are of opposite type, which is a contradiction. Therefore, our assumption must be false i.e., A is not a knight.
Case 2: Let us assume A is a knave, thus always lies. Therefore, B has to be a knave (opposite of what A says). B claims that the two are of opposite type, which is a lie based on the fact revealed by our assumption. Thus the two are of the same type, which is consistent is completely consistent with our assumption and the subsequent facts revealed.
Therefore the two have to be knaves.
HTH