A prison officer boasted that she had performed a sex act on an inmate, a court has heard.