There is no such provision under Law. But when such accused being examined by the Court under Section 313 of Cr.P.C may volunteer like that.
Section 313 in The Code Of Criminal Procedure, 1973
313. Power to examine the accused.(1) In every inquiry or trial, for the purpose of enabling the accused personally to explain any circumstances appearing in the evidence against him, the Court-
(a) may at any stage, without previously warning the accused, put such questions to him as the Court considers necessary;
(b) shall, after the witnesses for the prosecution have been examined and before he is called on for his defence, question him generally on the case: Provided that in a summons- case, where the Court has dispensed with the personal attendance of the accused, it may also dispense with his examination under clause (b).
(2) No oath shall be administered to the accused when he is examined under sub- section (1).
(3) The accused shall not render himself liable to punishment by refusing to answer such questions, or by giving false answers to them.
(4) The answers given by the accused may be taken into consideration in such inquiry or trial, and put in evidence for or against him in any other inquiry into, or trial for, any other offence which such answers may tend to show he has committed.
Disclaimer : This answer is based on information given by you hence, It is just opinion of Lawyer. For specific answer you have to give details and facts and choose the Lawyer of your choice.