classdef clA properties (Access = private) prop = 'valA'; end methods (Access = private) function privMeth (this) disp ('clA::privMeth'); end end methods function y = getProp (this, other) if nargin > 1 disp ('getProp: using "other"'); y = other.prop; else y = this.prop; end end function callPrivMeth (this, other) if nargin > 1 disp ('callPrivMeth: using "other"'); other.privMeth (); else this.privMeth (); end end end end