Classes are placed in different files
classdef ClassA < handle   
    properties
      value = []
    end
    methods
        function obj = ClassA(val)
            obj.value = val;
        end
    end
end
classdef ClassB < handle
    properties
      a = [];
    end
    methods
      function obj = ClassB(A)
          obj.a = A;
      end
      function obj = plus(obj, A)
          obj.a(end+1:end+numel(A)) = A;
      end
    end
end
Here the test
>> a = ClassA(10);
>> b = ClassB(a);
>> for i = 1:3
b = b+a;
end
>> parfor i = 1:3
b = b+a;
end
Error:
An UndefinedFunction error was thrown on the workers for 'plus'.  This might be because the file containing 'plus' is not accessible on the workers.  Use addAttachedFiles(pool, files) to specify
the required files to be attached.  See the documentation for 'parallel.Pool/addAttachedFiles' for more details.
Caused by:
    Undefined function 'plus' for input arguments of type 'ClassA'.
Edit: I have already tried to do the following commands without success.
>> addAttachedFiles(gcp(), 'ClassA.m')
>> addAttachedFiles(gcp(), 'ClassB.m')


