Since blocks `A and B` are stationary relative to `C` It means their acceleration will also be equal to a (rightward). Since mass `m` of block `A` is less than mass `M` of block `B` hence block `A` has tendency to slip upward while `B` has tendency to slip downward .
Since `A` has to slip upward therefore on its left surface will act downward and friction on both the surface of block `B` will act upward because it has tendency to slip downward hence , their free body diagram will be as shown in fig

For horizontal forces on `A ,N_(1) = ma`
For verticle equillibruim of `A`,
`T = (mu N_(1) + mg ) = (mu ma + mg)` ....(i)
For horizontal forces on `B N_(2) - N_(1) = Ma`
or `N_(2)= (m + M)a`
For verticle equillibruim of `B`
`T + mu N_(1) + mu N_(2) = Mg`
`(mu ma + mg) + mu ma + mu(m + M)a= Mg`
`a = (M - m)/(mu(3m + M)).g`