The attorney-client privilege allows a defendant to decline to disclose confidential communications with his or her lawyer, and to prevent the lawyer from disclosing the same. When someone—for example, a prosecutor conducting cross-examination—asks the defendant about any such communications, the defendant can rightfully refuse to answer (ideally, the defense attorney would object so that the client doesn’t have to determine whether to assert the privilege).
Although the law might vary somewhat from one jurisdiction to another and there are exceptions to confidentiality, in general, the privilege is the client’s, not the attorney’s. So, typically, an attorney who is asked about information received from or advice given to the client must refuse to answer. In general, the attorney must invoke the privilege unless the client has instructed otherwise; the lawyer must refuse to provide the requested information even if there is no case currently pending.