Ali ibn Ibrahim from his father from Muhammad ibn Yahya from Talhah ibn Zayd from Abu Abdillah عليه السلام, said:
Imam al-Sadiq عليه السلام said: “If the Imam is present at the funeral, then he is the most entitled of the people to perform the prayer over it.”
Ali Akbar al-Ghaffari
Tahdhīb al-Aḥkām fī Sharḥ al-Muqniʿah, vol. 3, p. 227