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).
The privilege is the client’s, not the attorney’s. That means that 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.