Indian railway seat number confusion

I have booked AC 3 tier train ticket from Varanasi to New Delhi for my friend and myself, both the tickets are confirmed but my seat number is 040 and my friend got 047 which doesn’t look like consecutive or adjacent seats.
Can you please confirm if these seats are in same compartment or not and how can we get adjacent seats? Varanasi to Delhi is a long journey and I don't like being separated from my travel partner on an overnight train. Please help!

Your seats are not very far and you got side berth for both of you, if you are not happy with the seat numbers then also you can ask anyone to swap seat with you after you get into the train. I have made this small diagram for your reference and I hope it will help you locate your seat/berth.