Hello sir my rank is 40000 and my froend rank is 36000 but my community rank is mbc 9000 and his was bc 20000 who will be called first

As per my knowledge, you friend will be called first. And you can check their official website for more information.
All the best.